package org.zjz.utils;

import javax.servlet.http.HttpSession;

/**
 * Created by asus on 2017/9/11.
 */
public class TLManager {

    private static ThreadLocal<HttpSession> sessionTl=new ThreadLocal<HttpSession>();

    public static HttpSession getSessionTl() {
        HttpSession _session= sessionTl.get();
        return _session;
    }

    public static void setSessionTl(HttpSession session) {
       HttpSession _session= sessionTl.get();
       if(_session==null){
            sessionTl.set(session);
       }
    }

    public static void closeSessionTl(){
        HttpSession _session= sessionTl.get();
        if(_session!=null){
            sessionTl.remove();
        }
    }
}
